home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 / Ham Radio 2000.iso / ham2000 / tcp_ip / gp / 7plus.h < prev    next >
C/C++ Source or Header  |  1991-12-21  |  4KB  |  186 lines

  1. /*---------*\
  2. >  7plus.h  <
  3. \*---------*/
  4.  
  5. #define YES "y"
  6. #define NO  "n"
  7. #define EOS '\0'
  8.  
  9. /* Uncomment next line, if compiling on AMIGA! */
  10. /* #define _AMIGA_ */
  11.  
  12. /** these includes should work anywhere **/
  13. #include <stdio.h>
  14. #include <string.h>
  15. #ifdef M_XENIX
  16.   #include <malloc.h>
  17.   #define SEEK_CUR        1
  18.   #define SEEK_END        2
  19.   #define SEEK_SET        0
  20.   typedef unsigned size_t;
  21. #else
  22.   #include <stdlib.h>
  23. #endif
  24. #include <ctype.h>
  25.  
  26. /** #defines, depending on the system and compiler **/
  27.  
  28. /* flags for fopen() */
  29. #define OPEN_READ_TEXT "r"
  30. #define OPEN_WRITE_TEXT "w"
  31. #define OPEN_APPEND_TEXT "a"
  32. #ifdef __unix__
  33.   #define OPEN_READ_BINARY "r"
  34.   #define OPEN_WRITE_BINARY "w"
  35.   #define OPEN_APPEND_BINARY "a"
  36. #else
  37.   #define OPEN_READ_BINARY "rb"
  38.   #define OPEN_WRITE_BINARY "wb"
  39.   #define OPEN_APPEND_BINARY "ab"
  40. #endif
  41.  
  42. /* Microsoft's Quick C has some different makros and function names **/
  43. #ifdef _QC
  44.   #define __MSDOS__
  45.   #define MAXDRIVE _MAX_DRIVE
  46.   #define MAXDIR   _MAX_DIR
  47.   #define MAXFILE  _MAX_FNAME
  48.   #define MAXEXT   _MAX_EXT
  49.   #define MAXPATH  _MAX_PATH
  50.   #define fnsplit  _splitpath
  51. #endif
  52.  
  53. #ifdef __MSDOS__
  54.   #ifdef __TURBOC__
  55.     #include <dir.h>
  56.   #endif
  57.   #include <conio.h>
  58.   #define PATHSEP "\\"
  59.   #define PATHCHAR '\\'
  60.   #define INDICATE 0xdb
  61.   #define MAXFNAME MAXFILE+MAXEXT-1
  62. #endif
  63.  
  64. #ifdef _AMIGA_
  65.   #undef  YES
  66.   #define YES ""
  67.   #undef  NO
  68.   #define NO ""
  69.   #define SEEK_SET 0
  70.   #define SEEK_CUR 1
  71.   #define SEEK_END 2
  72.   #define MAXPATH  300
  73.   #define MAXDRIVE 5
  74.   #define MAXDIR   220
  75.   #define MAXFILE  31
  76.   #define MAXEXT   31
  77.   #define PATHSEP  "/"
  78.   #define PATHCHAR '/'
  79.   #define INDICATE '*'
  80.   #define MAXFNAME MAXFILE
  81.   #define _FNSPLIT
  82.   #define _ICMP
  83.   #define getch getchar
  84. #endif
  85.  
  86. #ifdef __TOS__
  87.   #define MAXPATH   119
  88.   #define MAXDRIVE  3
  89.   #define MAXDIR    102
  90.   #define MAXFILE   9
  91.   #define MAXEXT    5
  92.   #define PATHSEP "\\"
  93.   #define PATHCHAR '\\'
  94.   #define INDICATE 0xdb
  95.   #define MAXFNAME MAXFILE+MAXEXT-1
  96.   #define _FNSPLIT
  97.   #include <ext.h>
  98. #endif
  99.  
  100.   
  101. #ifdef __unix__
  102. /* assumed limits (hope reasonable !!!) */
  103.   #define ON 0
  104.   #define OFF 1
  105.   #define MAXPATH 256
  106.   #define MAXDRIVE 16
  107.   #define MAXDIR 256
  108.   #define MAXFILE 32
  109.   #define MAXEXT 32
  110.   #define PATHSEP "/"
  111.   #define PATHCHAR '/'
  112. /*
  113.   #ifdef M_XENIX
  114.     #define INDICATE 0xdb
  115.   #else
  116. */
  117.     #define INDICATE '*'
  118. /*
  119.   #endif
  120. */
  121.   #define MAXFNAME MAXFILE
  122.   #define _ICMP
  123.   #define _FNSPLIT
  124.   #define getch my_getch
  125.  
  126.   #ifdef __i386__
  127.     #define SYSV
  128.   #endif
  129.  
  130.   #ifdef SYSV
  131.     #include <termio.h>
  132.     struct termio sg[2];
  133.   #else
  134.     #include <sgtty.h>
  135.     struct sgttyb sg[2];
  136.   #endif
  137. #endif /* __unix__ */
  138.  
  139. #define MAXFPATH MAXDRIVE+MAXDIR-1
  140.  
  141. /** shorthands for unsigned types **/
  142. typedef unsigned char byte;  /* 8bit unsigned char       */
  143. typedef unsigned int  uint;  /* 16 or 32bit unsigned int */
  144. typedef unsigned long ulong; /* 32bit unsigned long      */
  145.  
  146. /** function prototypes **/
  147. int  go_at_it       (int argc, char **argv);
  148. void init_crctab    (void);
  149. void init_decodetab (void);
  150. void init_codetab   (void);
  151. void crc_n_lnum     (uint *crc, int *linenumber, char *line);
  152. void crc2           (uint *crc, char *line);
  153. void add_crc2       (char *line);
  154. void kill_dest      (FILE *in, FILE *out, char *name);
  155. void test_file      (FILE *rein, char *destnam, int flag, int namsize);
  156. void build_DOS_name (char *name);
  157. int  crc_file       (char *file, char *s1, char *s2, int flag);
  158. int  mcrc           (char *line, int flag);
  159. int  test_exist     (char *filename);
  160. int  control_decode (char *name);
  161. int  decode_file    (char *name);
  162. int  encode_file    (char *name, long blocksize, char *searchbin);
  163. int  join_control   (char *file1, char *file2);
  164. int  join_err       (char *file1, char *file2);
  165. int  extract_files  (char *name, char *search);
  166. char *my_fgets      (char *string, register n, FILE *rein);
  167. int  my_putc        (int outchar, FILE *out);
  168. uint get_hex        (char *hex);
  169. int  rebuild        (char *line, int flag);
  170.  
  171. #ifdef _FNSPLIT
  172.   void fnsplit (char *pth,char *dr,char *pa,char *fn,char *ft);
  173. #endif
  174.  
  175. #ifdef _ICMP
  176.   char *strupr  (char *string);
  177.   char *strlwr  (char *string);
  178.   int  stricmp  (char *s1, char *s2);
  179.   int  strnicmp (char *s1, char *s2, int n);
  180. #endif
  181.  
  182. #ifdef __unix__
  183.   int my_getch (void);
  184.   char *strstr (char *s1, char *s2);
  185. #endif
  186.